<?php

namespace app\commons\command;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use app\commons\model\ActivityVideo;
use video\Alivideo;

class Video extends Command
{
    protected function configure()
    {
        $this->setName('video')->setDescription('下载视频');
    }

    /**
     * 处理下载视频
     * @param Input $input
     * @param Output $output
     * @return int|void|null
     */
    protected function execute(Input $input, Output $output)
    {
        $list = ActivityVideo::where(['status'=>1,'is_download_status'=>0])->field(['id'])->select();
        if(!empty($list)){
            foreach ($list as $item){
                $video = new Alivideo();
//        $res = $video->aliVideoUpload(6);
                $res = $video->aliVideoDownload($item['id']);
                echo 'ID：'.$item['id'].'下载视频结果：成功'.$res.PHP_EOL;
            }
        }
    }
}